const R = require('ramda')

const auditFields = [
  'createdAt',
  'updatedAt',
  'deletedAt',
  'createdBy',
  'updatedBy',
  'deletedBy',
]
const getMenuListByType = (fn, type, list) =>
  R.compose(fn, R.filter(R.compose(R.equals(type), R.prop('type'))))(list)
const omitAuditFieldsAnd = R.curry((fields, data) => {
  return R.omit([...auditFields, ...fields], data)
})

module.exports = {
  omitAuditFieldsAnd,
}
